package com.pomr.model.simstorage;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @作者：Administrator
 * @时间：17:49 2018/8/20 0020
 * @用途：SIM卡流量信息表
 * 与sim卡详细信息一对一
 **/
@Entity
@Table(name="sim_flow",uniqueConstraints = {@UniqueConstraint(columnNames={"detail_id"})})
public class SimFlow implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
    @GenericGenerator(name = "native", strategy = "native")//AUTO 在mysql中需要指定使用本地策略生成主键值
    private Integer id;//主键
    @Column(name="iccid", length=30)
    private String iccid;
    @Column(name="outdata", length=10)
    private String outdata;//已用流量
    @Column(name="totaldata", length=10)
    private String totaldata;//总流量
    @Column(name="surplusdata", length=10)
    private String surplusdata;//剩余流量-计算得出
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name="update_time")
    private Date updateTime;//更新时间

    @JsonIgnore
    @OneToOne(cascade = CascadeType.MERGE)
    @JoinColumn(name="detail_id")
    private SimStorageDetail detail;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOutdata() {
        return outdata;
    }

    public void setOutdata(String outdata) {
        this.outdata = outdata;
    }

    public String getTotaldata() {
        return totaldata;
    }

    public void setTotaldata(String totaldata) {
        this.totaldata = totaldata;
    }

    public String getSurplusdata() {
        return surplusdata;
    }

    public void setSurplusdata(String surplusdata) {
        this.surplusdata = surplusdata;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public SimStorageDetail getDetail() {
        return detail;
    }

    public void setDetail(SimStorageDetail detail) {
        this.detail = detail;
    }

    public String getIccid() {
        return iccid;
    }

    public void setIccid(String iccid) {
        this.iccid = iccid;
    }
}
